(function () {
		var IPerson = new Interface("IPerson", ["say", "walk"]);
		var Teacher = function () {
		}
		Teacher.prototype = {
			say : function (name) {
				alert(name);
			},
			walk : function (name) {
				alert(name);
			}
		};
		var Student = function () {
		}
		Student.prototype = {
			say : function () {
				alert('student');
			},
			walk : function () {
				alert('hh');
			}
		};
		var Factory = {
			createInstance : function (type) {
			var model;
				if (type) {
					switch (type.toLowerCase()) {
					case "student":
						model=new Student();
						break;
					case "teacher":
						model=new Teacher();
						break;
					}
					Interface.ensureImplements(model, IPerson);
				}
				return model;
			}			
		};
		var person = Factory.createInstance("Student");
		var teacher=Factory.createInstance("Teacher");
		person.say();
		teacher.say('22');
	})();
 